import java.io.IOException;

import System.AddSecreteSystem;
import System.GetSecreteSystem;
import System.IOTool;
import System.PrintSystem;

public class WaiGuan {
    private IOTool myIoTool = new IOTool();
    private AddSecreteSystem addSecreteSystem = new AddSecreteSystem();
    private GetSecreteSystem getSecreteSystem = new GetSecreteSystem();
    private PrintSystem printSystem = new PrintSystem();

    public void Secreat(String myString) throws IOException {
        char[] chars = String2CharArray(myString);
        chars = addSecreteSystem.operation(chars);
        myIoTool.WriteStringMethed(chars);
        printSystem.operation(CharArray2String(chars));
    }

    public void DisSecreat() throws IOException {
        char[] chars = myIoTool.getStringMethed();
        chars = getSecreteSystem.operation(chars);
        printSystem.operation(CharArray2String(chars));
    }

    private char[] String2CharArray(String myString) {
        char[] reChar = new char[myString.length()];
        for (int index = 0; index < myString.length(); index++)
            reChar[index] = myString.charAt(index);
        return reChar;
    }

    private String CharArray2String(char[] myString) {
        String neString = new String();
        for (char myChar : myString) {
            neString += myChar;
        }
        return neString;
    }

}
